﻿using Bangle.BLL;
using Bangle.Model;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Main : BasePage
{
    #region 属性
    public List<Sys_Module> list { get; set; }

    public DataTable dt_list { get; set; }
    #endregion

    Sys_ModuleBLL bll = new Sys_ModuleBLL();


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindTreeData();
        }
    }

    private void BindTreeData()
    {
        string swhere = "1=1";
        if (base.CurrentSession.LoginName.Trim() != "root")
        {
            swhere = " Valid=1 and ModuleId in (select ModuleId from Sys_Operation where RoleId= " + base.CurrentSession.RoleId
            + " and OperationTypeId=(select top(1) OperationTypeId from Sys_OperationType where OperationTypeCode='View'))"
            + " or [ModuleId] in (SELECT [ParentId] FROM Sys_Module "
            + " where ModuleId in (select ModuleId from Sys_Operation where RoleId= " + base.CurrentSession.RoleId
            + " and OperationTypeId=(select top(1) OperationTypeId from Sys_OperationType where OperationTypeCode='View')))";
        }
        list = bll.GetModelList(swhere);

        this.labLoginUser.Text = base.CurrentSession.UserName;
    }
}